home *** CD-ROM | disk | FTP | other *** search
/ PC Media 23 / PC MEDIA CD23.iso / share / prog / anubis / vdos.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-06-19  |  4.8 KB  |  183 lines

  1. // VDOS.H
  2. // (C) Anubis Software, Agosto 1995
  3.  
  4.  
  5. #ifndef VDOS.H
  6. #define VDOS.H
  7. // Esta librería lo que pretende es poder hacer de forma rápida la
  8. // Selección de un fichero.
  9. // ----------------------------------------------------+
  10. // Inclusión de librerías Borland C++                  |
  11. // ----------------------------------------------------+
  12. #include <dos.h>
  13. #include <stdlib.h>
  14.  
  15.  
  16. // ----------------------------------------------------+
  17. // Inclusión de librerías Anubis Software              |
  18. // ----------------------------------------------------+
  19. #include "mdefs.h"
  20. #include "ventana2.h"
  21. #include "tecexec.h"
  22. #include "textmode.h"
  23.  
  24. // ----------------------------------------------------+
  25. // Declaracion de variables globales                   |
  26. // ----------------------------------------------------+
  27. Ventana2 VDosVent;
  28. void interrupt (*VDosOldInterrupt)();
  29. BYTE mal,mbl;
  30. BYTE VCursorX,VCursorY;
  31.  
  32. void interrupt VDosInterrupt()  {
  33.  
  34.    asm cli
  35.    
  36.    asm mov mal,al
  37.    asm mov mbl,bl
  38.  
  39.    asm cmp ah,02h
  40.    asm je Nueva1002
  41.    asm cmp ah,03h
  42.    asm je Nueva1003
  43.    asm cmp ah,0ah
  44.    asm je Nueva10Fin
  45.    asm cmp ah,0eh
  46.    asm jz Nueva10Fin
  47.    asm cmp ah,13h
  48.    asm je Nueva1013
  49.    asm cmp ah,09h
  50.    asm je Nueva1009
  51.    asm cmp ah,01h
  52.    asm je final
  53.    VDosOldInterrupt();
  54.    asm jmp final
  55.  
  56. // Definir la posición del cursor, evidentemente en la ventana
  57. Nueva1002:;
  58.    asm mov VCursorX,dl
  59.    asm mov VCursorY,dh
  60. //     VDosVent.CursorX=_DL;
  61. //     VDosVent.CursorY=_DH;
  62. //     VentanaControlaCursor();
  63.    if(VCursorY > VDosVent.Alto-2)   VCursorY = VDosVent.Alto-3;
  64.  
  65. //   VentanaGotoXY(&VDosVent,VCursorX,VCursorY);
  66. //   Gotoxy(VCursorX,VCursorY);
  67.    asm jmp final
  68.  
  69. // Buscar la posición del cursor, evidentemente en la ventana
  70. Nueva1003:;
  71.    _DH=VDosVent.CursorY;
  72.    _DL=VDosVent.CursorX;
  73.    asm pop bp
  74.    asm pop di
  75.    asm pop si
  76.    asm pop ds
  77.    asm pop es
  78.    asm pop cx   // Como el resultado viene en dx debe ser asi.
  79.    asm pop cx
  80.    asm pop bx
  81.    asm pop ax
  82.    asm sti
  83.    asm iret
  84.  
  85. Nueva1009:;
  86. //   EscribeCAV(&VDosVent,'a',VDosVent.PosX + VDosVent.CursorX,VDosVent.PosY + VDosVent.CursorY,0x33);
  87.    VentanaPutch(&VDosVent,_AL);
  88.    asm jmp final
  89.  
  90.  
  91. Nueva10Fin:;
  92.    VentanaPutch(&VDosVent,_AL);
  93.    asm jmp final
  94. Nueva1013:;
  95. final:;
  96.    asm sti
  97. }// end VDosInterrupt
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107. void VDos(unsigned char car)
  108. {
  109.    static char buffer[300];
  110.    static int puntbuffer =0;
  111.    if(car == 13)  {
  112. // Caso en el que se manda un comando, en cierto modo bueno.
  113. // Sólo acepta que se escriba en la pantalla porque luego la
  114. // reestablece. Si el programa que se ejecuta usa raton,...
  115. // El cuelgue será precioso, sin poder evitarlo.
  116.       VentanaPutch(&VDosVent,'\n');
  117.       if(!cadenas_son_iguales(buffer,""))  {  
  118. //         EmulacionPantalla(&VDosVent);
  119.          system(buffer);
  120.          VPintarTodo();
  121.          VControlaCursor();
  122.       }  else  {
  123. // Caso en el que se pasa al dosshell de forma automática.
  124. // Es el caso más potente, pero con ciertas dificultades técnicas.
  125. // En realidad se crea un completo shell del DOS.
  126.          ide_mouse();
  127.          MouseOff();         //Se apaga el ratón
  128.          setvect(0x10, VDosOldInterrupt);   // Se devuelve la int 0x10 a su estado
  129.          Borrar_Pantalla();       // Se borra la pantalla
  130.          Gotoxy(0,0);             // Se establece la posición del cursor
  131.          system("");              // Se invoca a la creación del nuevo shell
  132.          VPintarTodo();           // Se recuperan los estados anteriores
  133.          InitMouse(0xFF);         // Cuando vuelve el sistema se vuelven a recuperar
  134.          show_mouse();
  135.          setvect(0x10, VDosInterrupt);      // Todos los estados anteriores
  136.          VControlaCursor();
  137.        }// end if
  138.       VentanaPutch(&VDosVent,'\n');
  139.       VentanaPuts(&VDosVent,">");
  140.       puntbuffer=0;
  141.       buffer[puntbuffer]=0;
  142.    }  else if (car == 8)  {
  143.     if(puntbuffer) {
  144.        buffer[--puntbuffer]=0;
  145.        VentanaPutch(&VDosVent, car);
  146.     }// end if
  147.       }  else  {
  148.  VentanaPutch(&VDosVent, car);
  149.  buffer[puntbuffer++]=car;
  150.  buffer[puntbuffer]=0;
  151.       }// endif
  152. }// end VDos
  153.  
  154.  
  155. void far TratarVDosTeclado(void)
  156. {
  157.    if( TopeVentanas == &VDosVent) 
  158.       VDos(BTAscii(EventTecla));
  159. }// end TrataDos
  160.  
  161. void VDosInicializar(void)
  162. {
  163.    copiar_cadena(VDosVent.Nombre, "DOS");
  164.    VentanaCoordenadas( &VDosVent, 0,1,80,24);
  165.    VentanaDefine( &VDosVent, V_PRESENTACION);
  166.    VDosVent.Caracteristicas |= MODIFICAR;
  167.    VDosVent.ColorTexto = TBLANCO;
  168.    VDosVent.ColorFondo = FCYAN;
  169.    VentanaTipoCursor(&VDosVent, CURSOR_NORMAL);
  170.    VentanaGotoXY(&VDosVent,0,0);
  171.    VDosOldInterrupt = getvect(0x10);
  172.    setvect(0x10,VDosInterrupt);
  173.    EventEmpilaKeyboardRutina(TratarVDosTeclado);
  174.    VentanaPutch(&VDosVent,'>');
  175. }
  176.  
  177. void VDosFinalizar(void)
  178. {
  179.    setvect(0x10, VDosOldInterrupt);
  180. }// end VDosFinalizar
  181.  
  182. #endif
  183.